Re: insert/update/delete returning and rules
От | Jens-Wolfhard Schicke |
---|---|
Тема | Re: insert/update/delete returning and rules |
Дата | |
Msg-id | 36B4DDEAF5A53F0D4C4F235F@[192.168.1.72] обсуждение исходный текст |
Ответ на | Re: insert/update/delete returning and rules (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
--On Dienstag, August 15, 2006 16:33:27 -0400 Tom Lane <tgl@sss.pgh.pa.us> wrote: > I'm tempted to suggest that the RETURNING commands might need to be > separate rule events, and that to support this you'd need to write > an additional rule: > > CREATE RULE r1 AS ON INSERT RETURNING TO myview DO INSTEAD > INSERT ... RETURNING ... > ... > > But even this seems like it would fail in complicated cases. What if > the view is a join, and your ON INSERT rule inserts into two different > underlying tables in two commands? If you need fields from both tables > to generate a full RETURNING list then there's no apparent way to make > it work. > > Ugh. Any ideas out there? CREATE RULE r1 AS ON INSERT RETURNING TO myview DO INSTEAD INSERT ... INTO tbl_1; INSERT ... INTO tbl_2; RETURNINGSELECT .... FROM tbl_1, tbl_2 WHERE ...; Just what crossed my mind first, no idea whether this is implementable or realistic or whatever. Mit freundlichem Gruß Jens Schicke -- Jens Schicke j.schicke@asco.de asco GmbH http://www.asco.de Mittelweg 7 Tel 0531/3906-127 38106 Braunschweig Fax 0531/3906-400
В списке pgsql-hackers по дате отправления: